/* 
 * File:   main.c
 * Author: Lucas
 *
 * Created on 11 de Novembro de 2014, 01:32
 */

#include <stdio.h>
#include <stdlib.h>

#ifndef NUM_ELEMENTOS
#define NUM_ELEMENTOS 300
#endif

typedef struct individuo individuo;

struct individuo
{
    char v[NUM_ELEMENTOS];
    individuo *next;
};

void leArquivo(int **vet);
/*
 * 
 */
int main(int argc, char** argv) {

    int *vet;
    int i;
    
    leArquivo(&vet);
    for(i=0;i<NUM_ELEMENTOS;i++) printf("%d - %d\n", (i+1), vet[i]);
    return (EXIT_SUCCESS);
}

void leArquivo(int **vet){
    FILE *fp;
    int i = 0;
    int aux = 0;
    char c = '0';

    *vet = malloc(NUM_ELEMENTOS*sizeof(int));
    
    fp = fopen("instancia_numbers.txt", "r");
    if(!fp) return;
    while(c != EOF){
        c = fgetc(fp);
        if(c=='\n'){
            *(*(vet)+i) = aux;
            i++;
            aux = 0;
        }
        else{
            aux = aux*10;
            aux += (int) c - '0';
        }
    }
    fclose(fp);
}

